package com.abel.quiz.controller;/**
 * Created by abel.lin on 2017/8/4.
 */

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author abel.lin
 * @date_time 2017/8/4 16:50
 * @description
 */
@RequestMapping("login")
@Controller
public class LoginController extends BaseController{
    @RequestMapping("")
    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String userName = getCurrentUserName();
        if(StringUtils.isNotBlank(userName)){
            response.sendRedirect("/admin/home");
        }
        ModelAndView view = new ModelAndView("admin/login");

        return view;
    }
}
